﻿/***************************************************************************/
/// <summary>
///  <title>SLIC UserData Model</title>
///  <description>UserData Model for User Details</description>
///  <copyRight>Copyright (c) 2010</copyRight>
///  <company>IronOne Technologies (Pvt)Ltd</company>
///  <createdOn>2011-08-01</createdOn>
///  <author></author>
///  <modification>
///     <modifiedBy></modifiedBy>
///      <modifiedDate></modifiedDate>
///     <description></description>
///  </modification>
///
/// </summary>
/***************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;

namespace SLIC.Models.UserAdministration
{
    [PropertiesMustMatch("password", "ConfirmPassword", ErrorMessage = "The new password and confirmation password do not match.")]
    public class UserDataModel
    {
        public UserDataModel()
        {
        }

        public UserDataModel(EntityModel.User user)
        {
            // TODO: Complete member initialization
            this.UserId = user.UserId;
            this.firstName = user.FirstName;
            this.lastname = user.LastName;
            this.CSRCode = user.CSR_Code;
        }

        public int UserId { get; set; }

        [Required(ErrorMessage = "*")]
        [StringLength(50, ErrorMessage = "User Name cannot be more than 50 characters.")]
        public string username { get; set; }

        //public string password { get; set; }

        [Required(ErrorMessage = "*")]
        [DataType(DataType.Password)]
        [ValidatePasswordLength(ErrorMessage = "Enter a strong passsword.")]
        public string password { get; set; }

        [Required(ErrorMessage = "*")]
        [ValidatePasswordLength(ErrorMessage = "Enter a strong passsword.")]
        [DataType(DataType.Password)]
        public string ConfirmPassword { get; set; }

        public string OldPassword { get; set; }

        [Required(ErrorMessage = "*")]
        public string firstName { get; set; }

        public string lastname { get; set; }

        [Required(ErrorMessage = "*")]
        public string email { get; set; }

        public string CSRCode { get; set; }

        public string[] roles { get; set; }

        public string roleName { get; set; }

        public bool isLocked { get; set; }

        public bool isAgent { get; set; }
    }
}